home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 September (IDG) / Sep99.iso / Shareware World / Comms & Internet / LinkConverter 1.1.2 / Dialog Director v0.7 / Examples / Currency Converter.as < prev    next >
Encoding:
Text File  |  1998-01-12  |  1.0 KB  |  25 lines  |  [TEXT/ToyS]

  1. -- Currency Converter.rsrc
  2. property exchangeRate : 1.68
  3. set dlog128 to {size:[320, 170], name:"Currency Converter", style:standard window, contents:[¬
  4.     {class:push button, bounds:[240, 140, 310, 160], name:"Convert", action:"convert"}, ¬
  5.     {class:text field, bounds:[220, 30, 295, 46], value:exchangeRate}, ¬
  6.     {class:text field, bounds:[220, 59, 295, 75], value:100}, ¬
  7.     {class:text field, bounds:[220, 90, 295, 106], value:100 * exchangeRate}, ¬
  8.     {class:static text, bounds:[30, 30, 205, 46], contents:"Exchange rate per £1:"}, ¬
  9.     {class:static text, bounds:[30, 60, 205, 76], contents:"Pounds to convert:"}, ¬
  10.     {class:static text, bounds:[30, 90, 205, 106], contents:"Amount in other currency:"} ¬
  11.         ], closeable:true ¬
  12.     }
  13.  
  14. dd auto dialog dlog128 with grayscale given script:me
  15.  
  16. on Convert()
  17.     try
  18.         set [a, b] to dd get value of items 2 thru 3 of dialog 1
  19.         dd set value of item 4 of dialog 1 to (a as number) * (b as number)
  20.         set exchangeRate to a
  21.     on error
  22.         dd set value of item 4 of dialog 1 to "?"
  23.         beep 2
  24.     end try
  25. end Convert